package day05;

import java.util.Scanner;

/**
 * @author Xiao
 * @date 2021/7/5
 */
public class PrintJava {
    /*
        需求：
            1.定义一个方法，打印10次我爱Java
            2.定义一个方法，打印n次我爱Java
     */
    public static void main(String[] args) {
        System.out.println("打印10次“我爱Java！”：");
        printJava();
        System.out.println("----------------");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入打印次数：");
        int n = sc.nextInt();
        printJava2(n);
    }

    private static void printJava2(int n) {
        for (int i = 0; i < n; i++) {
            System.out.println("我爱Java！");
        }
    }

    private static void printJava() {
        for (int i = 0; i < 10; i++) {
            System.out.println("我爱Java！");
        }
    }
}
